package com.heaven.jane.sourcegenerator.commons.security.authority.domain;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;

import com.heaven.jane.sourcegenerator.commons.security.user.domain.User;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 角色信息
 * @author heaven
 *
 */
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Authority implements Serializable {

	private static final long serialVersionUID = 1L;
	
	/**
	 * 主键id
	 */
	@Id
	@SequenceGenerator(name = "role_generator", sequenceName = "role_sequence", initialValue = 0)
	@GeneratedValue(generator = "role_generator")
	private Long id;
	
	/**
	 * 角色名
	 */
	private String name;
	
	/**
	 * 关联用户信息
	 */
	@ManyToMany(mappedBy = "authoritys")
	@Basic(fetch = FetchType.LAZY)
	private Set<User> users;
	
	
}
